﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Hired1Div.master" AutoEventWireup="true"
    CodeBehind="manageAccounts.aspx.cs" Inherits="Hired.manageAccounts" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadPlaceHolder" runat="server">
    <style type="text/css">
    .header_myimages
    {
        position: relative;
        float: left;
        margin-left: 10px;
        width: 695px;
        height: 25px;
        background: url(/images/Accounts-Text.png) no-repeat;
    }
    .ddlAccounts
    {
        float: left;
        margin-left: 15px;
    }
    p.text
    {
        float: left;
        text-align: right;
        padding: 2px;
    }
    
    .jobseekersAccountDataGrid
    {
       width: 100%;
       margin: 10px auto auto 15px;
       padding:  0px;
       float: left;
       overflow: scroll;
       text-align: center;
    }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainPlaceHolder" runat="server">
   
    <div class="header_myimages"><div class="headingline"></div></div>
    <div class="line-clear"><br /></div>
    <div class="ddlAccounts"><p class= "text" >Manage:</p>
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
            onselectedindexchanged="DropDownList1_SelectedIndexChanged">
            <asp:ListItem>Select...</asp:ListItem>
            <asp:ListItem>Admin Staff Accounts</asp:ListItem>
            <asp:ListItem>Jobseeker Accounts</asp:ListItem>
            <asp:ListItem>Company Accounts</asp:ListItem>
    </asp:DropDownList></div>
    <div class="line-clear"></div>
    <div>
    <!-- AdminStaffAccount Panel -->
    <asp:Panel class="dataGrid" ID="pnlAdminStaffAccountsDataGrid" runat="server" 
            Visible="False">
        <asp:GridView ID="gridViewASA" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ASAccountID" 
            DataSourceID="entSourceAdminStaffAccounts" CellPadding="10" 
            GridLines="Horizontal" onrowcommand="gridViewASA_RowCommand">
            <AlternatingRowStyle BackColor="#CCCCFF" />
            <Columns>
                
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="ASAccountID" HeaderText="ID" ReadOnly="True" 
                    SortExpression="ASAccountID" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="Username" HeaderText="Username" 
                    SortExpression="Username" />
                <asp:BoundField DataField="Password" HeaderText="Password" 
                    SortExpression="Password" />
                    <asp:TemplateField ShowHeader="False" HeaderText="Delete">
                        <ItemTemplate>
                            <asp:ImageButton ID="btnDelete" runat="server" ImageUrl="../images/deleteicon.png"
                                CausesValidation="False" CommandName="Delete" CommandArgument='<%# Eval("ASAccountID") %>' />
                            <asp:Panel ID="pnlDeletePopup" runat="server" CssClass="modalPopup">
                                Are you sure you wish to delete account
                                <asp:Label ID="lblUsername" runat="server" Text='<%# Eval("Username") %>' />?
                                <br />
                                <br />
                                <asp:Button ID="btnCancel" Style="float: right" runat="server" Text="Cancel" />
                                <asp:Button ID="btnConfirm" Style="float: right; margin-right: 25px;" runat="server" Text="OK" />
                                <asp:ConfirmButtonExtender ID="btnDelete_ConfirmButtonExtender" runat="server" ConfirmText=""
                                    Enabled="True" TargetControlID="btnDelete" DisplayModalPopupID="DeleteModalPopupExtender">
                                </asp:ConfirmButtonExtender>
                                <asp:ModalPopupExtender ID="DeleteModalPopupExtender" runat="server" TargetControlID="btnDelete"
                                    DropShadow="True" PopupControlID="pnlDeletePopUp" CancelControlID="btnCancel"
                                    OkControlID="btnConfirm" BackgroundCssClass="modalBackground">
                                </asp:ModalPopupExtender>
                                <br />

                            </asp:Panel>
                        </ItemTemplate>

                    </asp:TemplateField>
            </Columns>
            <HeaderStyle BackColor="#9933FF" ForeColor="White" HorizontalAlign="Center" />
            <PagerStyle BackColor="#9900FF" ForeColor="White" />
        </asp:GridView>
        <asp:EntityDataSource ID="entSourceAdminStaffAccounts" runat="server" 
            ConnectionString="name=hireddbEntities" DefaultContainerName="hireddbEntities" 
            EnableDelete="True" EnableFlattening="False" EnableInsert="True" 
            EnableUpdate="True" EntitySetName="AdminStaffAccounts">
        </asp:EntityDataSource>
    </asp:Panel>
    <div class="line-clear"></div>
   
    <!-- Jobseeker Panel-->
        
    <asp:Panel class="jobseekersAccountDataGrid" ID="pnlJobseekersAccountsDataGrid" 
            runat="server" Visible="False">
        <asp:GridView ID="gridViewJobseeker" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="JAccountID,Username,Password" 
            DataSourceID="EntityDataSource1" CellPadding="10" 
            GridLines="Horizontal" onrowcommand="gridViewJobseeker_RowCommand">
            <AlternatingRowStyle BackColor="#CCCCFF" />
            <Columns>
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="JAccountID" HeaderText="ID" ReadOnly="True" 
                    SortExpression="JAccountID" />
                <asp:TemplateField HeaderText="Username" SortExpression="Username">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkBtnJobseeker" runat="server" Text='<%# Eval("Username") %>' PostBackUrl='<%# "~/viewjsprofile?username=" + Eval("Username") %>'></asp:LinkButton>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Username") %>'></asp:Label>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="FirstName" HeaderText="First Name" 
                    SortExpression="FirstName" />
                <asp:BoundField DataField="LastName" HeaderText="Last Name" 
                    SortExpression="LastName" />
                <asp:BoundField DataField="Gender" HeaderText="Gender" 
                    SortExpression="Gender" />
                <asp:BoundField DataField="Specialization" HeaderText="Industry" 
                    SortExpression="Specialization" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="Activated" HeaderText="Activated" 
                    SortExpression="Activated" />
                    <asp:TemplateField ShowHeader="False" HeaderText="Delete">
                        <ItemTemplate>
                            <asp:ImageButton ID="btnDelete" runat="server" ImageUrl="../images/deleteicon.png"
                                CausesValidation="False" CommandName="Delete" CommandArgument='<%# Eval("JAccountID") %>' />
                            <asp:Panel ID="pnlDeletePopup" runat="server" CssClass="modalPopup">
                                Are you sure you wish to delete account
                                <asp:Label ID="lblUsername" runat="server" Text='<%# Eval("Username") %>' />?
                                <br />
                                <br />
                                <asp:Button ID="btnCancel" Style="float: right" runat="server" Text="Cancel" />
                                <asp:Button ID="btnConfirm" Style="float: right; margin-right: 25px;" runat="server" Text="OK" />
                                <asp:ConfirmButtonExtender ID="btnDelete_ConfirmButtonExtender" runat="server" ConfirmText=""
                                    Enabled="True" TargetControlID="btnDelete" DisplayModalPopupID="DeleteModalPopupExtender">
                                </asp:ConfirmButtonExtender>
                                <asp:ModalPopupExtender ID="DeleteModalPopupExtender" runat="server" TargetControlID="btnDelete"
                                    DropShadow="True" PopupControlID="pnlDeletePopUp" CancelControlID="btnCancel"
                                    OkControlID="btnConfirm" BackgroundCssClass="modalBackground">
                                </asp:ModalPopupExtender>
                                <br />

                            </asp:Panel>
                        </ItemTemplate>

                    </asp:TemplateField>
            </Columns>
            <HeaderStyle BackColor="#9933FF" ForeColor="White" HorizontalAlign="Center" />
            <PagerStyle BackColor="#9900FF" ForeColor="White" />
        </asp:GridView>
        
        <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
            ConnectionString="name=hireddbEntities" DefaultContainerName="hireddbEntities" 
            EnableFlattening="False" EnableUpdate="True" 
            EntitySetName="manageJobseekerViews">
        </asp:EntityDataSource>
        
    </asp:Panel>

    <!-- Company Panel-->
    <asp:Panel class="dataGrid" ID="pnlCompanyAccountsDataGrid" runat="server" 
            Visible="False">
           
        <asp:GridView ID="gridViewCompany" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="CAccountID,CompanyName" 
            DataSourceID="manageCompanies" CellPadding="10" 
            GridLines="Horizontal" onrowcommand="gridViewCompany_RowCommand">
            <AlternatingRowStyle BackColor="#CCCCFF" />
            <Columns>
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="CAccountID" HeaderText="ID" ReadOnly="True" 
                    SortExpression="CAccountID" />
                <asp:TemplateField HeaderText="Company Name" SortExpression="CompanyName">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkBtnCompany" runat="server" 
                            Text='<%# Eval("CompanyName") %>' PostBackUrl='<%#"~/viewprofile.aspx?username=" + Eval("Username") %>'></asp:LinkButton>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("CompanyName") %>'></asp:Label>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="ContactNumber" HeaderText="Contact Number" 
                    SortExpression="ContactNumber" />
                <asp:BoundField DataField="ImageAddress" HeaderText="Image Address" 
                    SortExpression="ImageAddress" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:TemplateField ShowHeader="False" HeaderText="Delete">
                        <ItemTemplate>
                            <asp:ImageButton ID="btnDelete" runat="server" ImageUrl="../images/deleteicon.png"
                                CausesValidation="False" CommandName="Delete" CommandArgument='<%# Eval("CAccountID") %>' />
                            <asp:Panel ID="pnlDeletePopup" runat="server" CssClass="modalPopup">
                                Are you sure you wish to delete account
                                <asp:Label ID="lblUsername" runat="server" Text='<%# Eval("Username") %>' />?
                                <br />
                                <br />
                                <asp:Button ID="btnCancel" Style="float: right" runat="server" Text="Cancel" />
                                <asp:Button ID="btnConfirm" Style="float: right; margin-right: 25px;" runat="server" Text="OK" />
                                <asp:ConfirmButtonExtender ID="btnDelete_ConfirmButtonExtender" runat="server" ConfirmText=""
                                    Enabled="True" TargetControlID="btnDelete" DisplayModalPopupID="DeleteModalPopupExtender">
                                </asp:ConfirmButtonExtender>
                                <asp:ModalPopupExtender ID="DeleteModalPopupExtender" runat="server" TargetControlID="btnDelete"
                                    DropShadow="True" PopupControlID="pnlDeletePopUp" CancelControlID="btnCancel"
                                    OkControlID="btnConfirm" BackgroundCssClass="modalBackground">
                                </asp:ModalPopupExtender>
                                <br />

                            </asp:Panel>
                        </ItemTemplate>

                    </asp:TemplateField>
            </Columns>
            <HeaderStyle BackColor="#9933FF" ForeColor="White" HorizontalAlign="Center" />
            <PagerStyle BackColor="#9900FF" ForeColor="White" />
        </asp:GridView>
            <asp:EntityDataSource ID="manageCompanies" runat="server" 
            ConnectionString="name=hireddbEntities" DefaultContainerName="hireddbEntities" 
            EnableFlattening="False" EnableUpdate="True" EntitySetName="manageCompanyViews">
        </asp:EntityDataSource>
       
    </asp:Panel>
    </div>
    
</asp:Content>
